#!/usr/bin/python
#-*-<coding=UTF-8>-*-

"""
这个例子展示了wxImage/wxBitmap的使用
"""

import wx

filenames = ["a.bmp","b.jpg","c.png","d.gif"]

class MyFrame(wx.Frame):

	def __init__(self):
		wx.Frame.__init__(self,parent=None,id=-1,title="Test Frame")
		panel = wx.Panel(self)

		fgs = wx.FlexGridSizer(cols=2,vgap=10,hgap=10)
		for name in filenames:
			img = wx.Image(name,wx.BITMAP_TYPE_ANY)

			w = img.GetWidth()
			h = img.GetHeight()

			img_2 = img.Scale(w/2,h/2)

			stb1 = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img))
			stb2 = wx.StaticBitmap(panel,-1,wx.BitmapFromImage(img_2))

			fgs.Add(stb1)
			fgs.Add(stb2)

		panel.SetSizerAndFit(fgs)
		self.Fit()


if __name__ == "__main__":
	app = wx.PySimpleApp()
	frame = MyFrame()
	frame.Show()
	app.MainLoop()
